import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
import { ProductCategory } from './productCategory';

@Define.Table({ TableName: 'category' })
export class Category extends EntityObjectType<Category> {
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    name: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        DefaultValue: 'base'
    })
    type: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        IsIndex: true
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.INT,
        DefaultValue: 0
    })
    indexNo: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;

    productCategory: ProductCategory[];
}

export const CategoryTypeType = {
    Base: 'base',
    Statistical: 'statistical',
    KitchenPrint: 'kitchenPrint'
}